package com.yanqu.road.server.cmd.activity.zhenhuan;

import com.yanqu.road.entity.player.UserBaseInfo;
import com.yanqu.road.logic.pb.PlayerBasePb;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.ZhenHuanProto;
import com.yanqu.road.pb.player.PlayerProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.activity.zhenhuan.CrossZhenHuanMgr;
import com.yanqu.road.server.manager.activity.zhenhuan.CrossZhenHuanThirdProcessActivity;
import com.yanqu.road.server.manager.user.CrossUserMgr;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.GameErrorCode;
import com.yanqu.road.server.protocol.Protocol;
import com.yanqu.road.utils.YanQuMessageUtils;

@Cmd(code = CrossProtocol.C_CROSS_ZHENHUAN_THIRD_PROCESS_SELF_DATA_SYNC, desc = "同步个人活动信息")
public class CrossZhenHuanThirdProcessSelfDataSyncCmd extends CrossCommand {

    private int activityId;

    private long userId;
    private boolean isWorship = false;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        ZhenHuanProto.CrossZhenHuanThirdProcessGetSelfDataReqMsg reqMsg = ZhenHuanProto.CrossZhenHuanThirdProcessGetSelfDataReqMsg.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        isWorship = reqMsg.getIsWorship();
        userId = packet.getPlayerId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CrossZhenHuanThirdProcessActivity activity = CrossZhenHuanMgr.getThirdProcessActivity(activityId);
        if (activity == null) {
            return;
        }
        activity.selfDataSync(serverId, userId, isWorship);
   }

    @Override
    public void sendData() {

    }
}
